using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_CostCenterMap : EntityTypeConfiguration<so_CostCenter>
    {
        public so_CostCenterMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Cost_center, t.ID, t.Header, t.Default });

            // Properties
            this.Property(t => t.description)
                .HasMaxLength(30);

            this.Property(t => t.Cost_center)
                .IsRequired()
                .HasMaxLength(9);

            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            // Table & Column Mappings
            this.ToTable("so_CostCenter");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.Cost_center).HasColumnName("Cost_center");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Header).HasColumnName("Header");
            this.Property(t => t.Default).HasColumnName("Default");
        }
    }
}
